<template>
  <div class="son">
    <div>从父组件获取零花钱: {{ pinMoney }}</div>
    <button @click="sendToy('奥特曼')">发送玩具信息</button>
    <button @click="plusOneA($parent)">第一种加1方式</button>
  </div>
</template>

<script setup lang="ts">
import {
  type ComponentInternalInstance,
  getCurrentInstance,
  onMounted,
} from "vue";

defineProps<{
  pinMoney: number;
  sendToy: (toy: string) => void;
}>();
let instance: ComponentInternalInstance;

onMounted(() => {
  instance = getCurrentInstance()!;
});

function plusOneA(v: any) {
  v.counter += 1;
}
</script>

<style scoped>
@import "../common.css";
</style>
